#!/bin/bash
# You can call this script like this:
# $./volume up
# $./volume down
# $./volume mute

DIR="$HOME/.config/dunst"

function get_bright {
      brillo | awk -F'.' '{print $1}'
}

function send_notification {
  bright=`get_bright`
  bar=$(seq -s "─" 0 $(($bright / 5)) | sed 's/[0-9]//g')
  icon_name="$DIR/icons/brightness.svg"
  # dunstify " Volume " "$bar" -i $icon_name -r 5555 -u normal
  dunstify "Brightness $bright% " -i $icon_name -r 5555 -u normal -h int:value:$(($bright)) 
  # notify-send.sh "Volume : $volume" -i "$icon_name" -t 2000 --replace=555
}

case $1 in
  up)
    brillo -A 10
    send_notification
    ;;
  down)
    brillo -U 10 
    send_notification
    ;;
esac
